/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package Filter;


import java.util.Date;
import javax.servlet.ServletContext;
import javax.servlet.ServletContextEvent;
import javax.servlet.ServletContextListener;
import javax.servlet.annotation.WebListener;


/**
 *
 * @author Alvaro
 */

@WebListener
public class Listener implements ServletContextListener{
    public void contextInitialized(ServletContextEvent contextEvent)
    {
        ServletContext contexto = contextEvent.getServletContext();
        System.out.println("La aplicacion se esta iniciando en el contexto "+contexto.getContextPath()+" a las "
                +getTime());
    
    }
    
    public void contextDestroyed(ServletContextEvent contextEvent)
    {
        ServletContext contexto = contextEvent.getServletContext();
        System.out.println("Aplicacion "+contexto.getContextPath()+" detenida a las "+getTime()+" !");
    }

    private String getTime()
    {
        return new Date(System.currentTimeMillis()).toString();
    }

    
}